package com.example.wechat.Fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.example.wechat.Adapter.Recycler_Adapter;
import com.example.wechat.R;
import com.example.wechat.ui.Mode;

import java.util.ArrayList;
import java.util.List;


public class Fg_weixin extends Fragment {
    private RecyclerView re_list;
    private List<Mode> list=new ArrayList<>();
    private View view;
    public Fg_weixin(){}
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        view=inflater.inflate(R.layout.activity_fg_weixin,container,false);
        initView();
        d_data();
        return view;
    }
    public void initView() {
        re_list=view.findViewById(R.id.list_view);
        re_list.setLayoutManager (new LinearLayoutManager(getActivity (),LinearLayoutManager.VERTICAL,false));
        Recycler_Adapter adapter=new Recycler_Adapter(list);
        re_list.setAdapter(adapter);
    }
    public void d_data() {
        for (int i=0;i<3;i++)
        {
            list.add(new Mode(R.mipmap.data1,"Bak","好消息，明天休息一天","晚上11:05"));
            list.add(new Mode(R.mipmap.data2,"未来可期","继续努力吧！","上午12:45"));
            list.add(new Mode(R.mipmap.data3,"沐雨橙风","你好，在吗，在吗！","下午13:10"));
            list.add(new Mode(R.mipmap.data4,"朋友","[语言]","昨天"));
            list.add(new Mode(R.mipmap.data5,"家人","[视频通话]","周一"));
        }

    }

}
